from django.db import models


class RemoteUser(models.Model):
    """
    远程登录用户：1、私钥，密钥 2、用户密码
    """
    auth_type_choices = (
        (0, 'ssh-password'),
        (1, 'ssh-key'),
    )

    auth_type = models.SmallIntegerField(choices=auth_type_choices)

    username = models.CharField(max_length=64)

    password = models.CharField(max_length=64, blank=True, null=True)

    class Meta:
        unique_together = ("auth_type", "username", "password")

    def __str__(self):
        return f'{self.username}:{self.password}'
